<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
        /*table thead .layui-table-col-special:nth-child(2n){background-color:#ddebf7}
        table thead .layui-table-col-special:nth-child(2n-1){background:#fce4d6}*/
        .select_div{width:50px;display:inline-block}
        .select_div select{height:auto}
        
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>{$nav}</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
    </div>
    <div class="x-body x-admin" style="padding:10px 8%">
        <div style="font-size:20px;padding:10px;text-align:center;border-bottom:1px solid #999;margin-bottom:20px;">
            <form class="layui-form" action="">
            <div class="layui-input-inline" style="width:90px">
                <select>
                    <option>2022</option>
                </select>
            </div>
            年
            <div class="layui-input-inline" style="width:65px">
                <select lay-filter="month">
                    <option value="02" {$month=='02'?'selected':''}>02</option>
                    <option value="03" {$month=='03'?'selected':''}>03</option>
                    <option value="04" {$month=='04'?'selected':''}>04</option>
                    <option value="05" {$month=='05'?'selected':''}>05</option>
                    <option value="06" {$month=='06'?'selected':''}>06</option>
                    <option value="07" {$month=='07'?'selected':''}>07</option>
                    <option value="08" {$month=='08'?'selected':''}>08</option>
                    <option value="09" {$month=='09'?'selected':''}>09</option>
                    <option value="10" {$month=='10'?'selected':''}>10</option>
                    <option value="11" {$month=='11'?'selected':''}>11</option>
                    <option value="12" {$month=='12'?'selected':''}>12</option>
                </select>
            </div>
            月度赛事直播收益汇总表
            </form></div>
        <?php $count=$income=$performance=0; ?>
        {volist name="departData" id="v" key="k"}
      <div class="layui-table-body layui-table-main" style="width: 44%;margin:0 2%;min-height:0;display: inline-flex;">

        <table class="layui-table layui-form" lay-filter="performance{$k}" id="performance{$k}" >
            <thead>
                <tr>
                    <th>{$v.group_name}</th>
                    <th>活动场次</th>
                    <th>营业额</th>
                    <th>业绩</th>
                    <th>组内排名</th>
                    <th>公司排名</th>
                </tr>
            </thead>
            <tbody>
                <?php $kkk=1;$count+=$v['count'];$income+=$v['income'];$performance+=$v['performance']; ?>

                <!--<thead>-->
                <!--<tr>-->
                <!--    <td></td>-->
                <!--    <td></td>-->
                <!--    <td></td>-->
                <!--    <td></td>-->
                <!--    <td></td>-->
                <!--    <td></td>-->
                <!--</tr>-->
                <!--</thead>-->
                {volist name="memberData" id="vv" key="kk"}
                {if condition="$vv['id'] == $v['id'] || in_array($vv['id'],explode(',',$v['group_members'])) "}
                <?php 
                    if($vv['performance'] != 0 &&  $vv['count'] != 0){
                        $znpm = $nznpm = $kkk;
                        $gspm = $ngspm = $kk;
                    }else{
                        $znpm = '';
                        $gspm = '';
                    }
                ?>
                <tr>
                    <td>{if condition="$vv.group_id == 5"}★{/if}{$vv.name}</td>
                    <td>{$vv.count}</td>
                    <td>{$vv.income}</td>
                    <td>{$vv.performance}</td>
                    <td>{$znpm}</td>
                    <td>{$gspm}</td>
                </tr>
                
                {if !$_GET['month']}
                <script>
                $(function(){
                    $.get('{:url('ds/updateRank')}?id={$vv['id']}&month_depart_rank={$znpm}&month_company_rank={$gspm}&month_performance={$vv.performance}')
                })
                </script>
                {/if}
                <?php $kkk++;?>
                {/if}
                {/volist}
                <tfoot>
                    <tr>
                        <td><b>总计</b></td>
                        <td>{$v.count}</td>
                        <td>{$v.income}</td>
                        <td>{$v.performance}</td>
                        <td>人数:{$kkk-1}</td>
                        <td></td>
                    </tr>
                </tfoot>
            </tbody>

        </table>
      </div>
      {/volist}
    </div>

        
    <script>
      layui.use(['form','layer','jquery','table','util'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,table = layui.table
        ,util = layui.util;
        
        form.on('select(month)', function(data){
            window.location.href="?month="+data.value
        });
        
      })

    </script>
  </body>

</html>